var DragAble = function (dragable,handler) {
	this.iDiffX = 0;
	this.iDiffY = 0;
	this.oDragable = dragable;
	this.oHandler = handler;
	
	this.mouseDown = function(){
		document.body.onselectstart = function () {return false;};
		document.body.style.userSelect = "none";
		document.body.style.MozUserSelect = "none";
		var object = arguments.callee.object;
		var event = arguments[0] || window.event;
		object.iDiffX = event.clientX - object.oDragable.offsetLeft;
		object.iDiffY = event.clientY - object.oDragable.offsetTop;
		document.body.onmousemove = object.mouseMove;
		document.body.onmouseup = object.mouseUp;
		object.oHandler.style.cursor = "move";
	};
	this.mouseDown.object = this;
	
	this.oHandler.onmousedown = this.mouseDown;
	
	this.mouseMove = function() {
		var object = arguments.callee.object;
		var event = arguments[0] || window.event;
		var wWidth = getWindowSize()[0];
		if ((event.clientX - object.iDiffX) >= 0 && (event.clientX - object.iDiffX + object.oDragable.clientWidth) <= wWidth - 20){
			object.oDragable.style.left = event.clientX - object.iDiffX + "px";
		}
		else {
			if ((event.clientX - object.iDiffX) < 0){
				object.oDragable.style.left = 0 + "px";
			}
			else {
				object.oDragable.style.left = wWidth - object.oDragable.clientWidth - 20 + "px";
			}
		}
		//obj.style.left = tempLeft + "px";
		if ((event.clientY - object.iDiffY) >= 0){
			object.oDragable.style.top = event.clientY - object.iDiffY + "px";
		}
		else {
			object.oDragable.style.top = 0 + "px";
		}
		
	};
	this.mouseMove.object = this;
	
	this.mouseUp = function() {
		var object = arguments.callee.object;
		document.body.onselectstart = "";
		document.body.style.userSelect = "";
		document.body.style.MozUserSelect = "";
		document.body.onmousemove = "";
		document.body.onmouseup = "";
		object.oHandler.style.cursor = "";
	};
	this.mouseUp.object = this;
};
